/*=====================================================
Critical Links
Auto Configuration Server

Authors:
	Rui Eduardo Gouveia Gil - r-gil@critical-links.com

Date: 2010
Version 0.1
=======================================================*/
#ifndef __SGUI_H__
#define __SGUI_H__

#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <rgcpp/utils/ZipFile.h>
#include <rgcpp/structs/Sequence.h>
#include <rgcpp/structs/FileLock.h>
#include <boost/algorithm/string.hpp>

namespace acs
{

class SGui
{
	private:
		static std::string TMP_FILE_PEFIX;
		static rgcpp::Sequence<int> fileID;

	public:
		static std::vector<std::string> createGroup(std::string name, std::string description);
		static std::vector<std::string> saveGroup(int id, std::string name, std::string description);
		static std::vector<std::string> getGroup(int id);
		static std::vector<std::string> getGroups();
		static std::vector<std::string> removeGroup(int id);

		static std::vector<std::string> createConfiguration(std::string name, bool rwan, bool rusers, std::string description);
		static std::vector<std::string> saveConfiguration(int id, std::string name, bool rwan, bool rusers, std::string description);
		static std::vector<std::string> clearConfigurationBackupRestoreFile(int id);
		static std::vector<std::string> getConfiguration(int id);
		static std::vector<std::string> getConfigurations();
		static std::vector<std::string> removeConfiguration(int id);

		static std::vector<std::string> createDevice(std::string name, std::string license, int configID, int configMode, int groupID, std::string description, std::string actionPeriod);
		static std::vector<std::string> saveDevice(int id, std::string name, std::string license, int configID, int configMode, int groupID, std::string description, std::string actionPeriod);
		static std::vector<std::string> validateDevice(int id);
		static std::vector<std::string> backupDevice(int id, bool sounds);
		static std::vector<std::string> getDevice(int deviceID);
		static std::vector<std::string> getDevices();
		static std::vector<std::string> getGroupDevices(int groupID);
		static std::vector<std::string> getConfigurationDevices(int configID);
		static std::vector<std::string> removeDevice(int id);

		static std::vector<std::string> setDeviceCommands(int id, std::vector<std::string> commands);
		static std::vector<std::string> addDeviceCommand(int id, std::string command, std::vector<std::string> arguments);
		static std::vector<std::string> getDeviceCommands(int id);
		static std::vector<std::string> removeDeviceCommand(int id, int index);
		static std::vector<std::string> removeDeviceCommands(int id);

		static std::vector<std::string> moveDeviceToGroup(int id,int groupID);
		static std::vector<std::string> applyConfigurationToGroups(int configurationID, std::vector<int> groups);
		static std::vector<std::string> applyConfigurationToDevices(int configurationID, std::vector<int> devices);

		static std::vector<std::string> getLogs(int level, int offset, int limit);
		static std::vector<std::string> getDeviceLogs(int deviceID, int level, int offset, int limit);

		static std::vector<std::string> changePassword(std::string oldPass, std::string newPass);

	private:
		static std::string generateBackupSHA(const std::string& filePath, const std::string& restoreOptions);
};

}

#endif

